package com.lanou.dllo.baisibudejie.fragment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lanou.dllo.baisibudejie.R;
import com.lanou.dllo.baisibudejie.activity.SendImageActivity;
import com.lanou.dllo.baisibudejie.activity.SendJokeActivity;
import com.lanou.dllo.baisibudejie.activity.SendVoiceActivity;


/**
 * Created by dllo on 15/10/22.
 */
public class PostFragment extends Fragment implements View.OnClickListener {

    private TextView send_jokeTv,send_imageTv,send_voiceTv;



    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
    }


    /**
     * 在这个方法里面，获取传入的数据
     *
     * @param savedInstanceState
     */
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    /**
     * 这个方法里面加载布局
     */
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_post, null);

        return view;
    }


    /**
     * 控件初始化在这写
     */
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        send_jokeTv = (TextView) view.findViewById(R.id.send_jokeTv);
        send_jokeTv.setOnClickListener(this);
        send_imageTv = (TextView) view.findViewById(R.id.send_imageTv);
        send_imageTv.setOnClickListener(this);
        send_voiceTv = (TextView) view.findViewById(R.id.send_voiceTv);
        send_voiceTv.setOnClickListener(this);
    }


    /**
     * 数据初始化在这写
     *
     * @param savedInstanceState
     *
     */
    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.send_jokeTv:

                Intent intent = new Intent(getActivity(), SendJokeActivity.class);
                startActivity(intent);

                break;

            case R.id.send_imageTv:

                Intent intent_image = new Intent(getActivity(), SendImageActivity.class);

                startActivity(intent_image);

                break;

            case R.id.send_voiceTv:
                Intent intent_voice = new Intent(getActivity(), SendVoiceActivity.class);

                startActivity(intent_voice);
                break;
        }
    }
}
